img,
video {
  height: auto;
  max-width: 100%;
  display: block;
}

audio {
  width: 100%;
  margin-bottom: 20px;
}

video {
  width: 100%;
  height: auto;
  max-height: 400px;
}

.img-responsive {
  /* Extend Bootstrap declaration with centering. */
  margin: 0 auto;
}

/*************************************************
 *  Image zoom on hover for previews.
 **************************************************/

/* Hide overflowing of zoomed child img element */
.img-hover-zoom {
  overflow: hidden;
}

/* Smooth transition for image zoom on hover */
.img-hover-zoom img {
  transition: transform 0.3s ease-in-out;
}

/* Transform the image scale when container gets hovered */
.img-hover-zoom:hover img {
  transform: scale(1.1);
}

/*************************************************
 *  Figures
 **************************************************/

figure {
  img {
    height: auto;
    max-width: 100%;
  }

  figcaption {
    margin-top: 0.75em;
    margin-bottom: 1.65rem;
    line-height: 1.4;
    font-size: 0.76rem;
    text-align: center; // Center figure captions.
  }

  figcaption.numbered::before {
    font-weight: 700;
    text-transform: uppercase;
    content: attr(data-pre) counter(captions) attr(data-post);
  }

  figcaption.numbered {
    counter-increment: captions;
  }
}

/*************************************************
 *  Dynamic theming.
 **************************************************/

// Dynamically theme `img`
.dark .img-light,
body:not(.dark) .img-dark {
  filter: invert(1);
}

// Dynamically theme inline `svg`
svg {
  fill: currentColor;
}

/*************************************************
 *  Image zooming.
 **************************************************/

.medium-zoom-overlay,
.medium-zoom-image--opened {
  z-index: 1031; // Nav bar index +1.
}

/*************************************************
 *  Gallery shortcode.
 **************************************************/

.fancybox-caption {
  font-size: 1rem;
  line-height: 1.5rem;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-gap: 30px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: 150px;
  grid-auto-flow: row dense;
}

.gallery-item {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  color: #fff;
  grid-column-start: auto;
  grid-row-start: auto;
  background-size: cover;
  background: #000 center;
  box-shadow: -2px 2px 10px 0 rgba(#444, 0.4);
  transition: transform 0.3s ease-in-out;
  cursor: zoom-in;
  counter-increment: item-counter;
  overflow: hidden;

  a {
    z-index: 1;
  }

  a[data-fancybox] {
    text-decoration: none;
    cursor: zoom-in;
  }

  img {
    all: initial;
    object-fit: cover;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    cursor: zoom-in;
    // Satisfy Lighthouse criteria even if a lazy image hasn't loaded yet.
    min-height: 48px;
    min-width: 48px;
  }

  &:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    // background-color: black;
    // opacity: 0.3;
    // transition: opacity 0.3s ease-in-out;
  }

  &:hover {
    transform: scale(1.05);

    //&:after {
    //  opacity: 0;
    //}
  }

  &--medium {
    grid-row-end: span 2;
  }

  &--large {
    grid-row-end: span 3;
  }

  &--full {
    grid-column-end: auto;

    @media screen and (min-width: 768px) {
      grid-column: 1/-1;
      grid-row-end: span 2;
    }
  }
}
